<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>记住用户</title>
</head>
<body>
    <fieldset>
        <legend>用户信息</legend>
        <div>
            账号：<input id="userName"/>
        </div>
        <div>
            密码：<input id="password" type="password"/>
        </div>
        <button id="login">登录</button>
    </fieldset>
    <script>
        login.onclick = function(){
            localStorage.setItem("userName", userName.value)
            localStorage.setItem("password", password.value)
        }
        window.onload = function(){
            userName.value =  localStorage.getItem("userName")
            password.value =  localStorage.getItem("userName")
        }
    </script>
</body>
</html>